package com.operator.Activitys.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.operator.Activitys.R;
import com.operator.Activitys.activity.base.BaseActivity;
import com.operator.Activitys.utils.Constant;
import com.operator.Activitys.utils.JumperUtils;
import com.zhy.autolayout.AutoRelativeLayout;

import butterknife.Bind;
import butterknife.OnClick;

/**
 * 项目名称：金泽云 手机app
 * 类描述：自助查询
 * 创建人：张飞祥
 * 创建时间：2018/6/21 10:30
 * 修改人：张飞祥
 * 修改时间：2018/6/21 10:30
 * 修改备注：
 */
public class SelfQueryActivity extends BaseActivity {

    //返回按钮
    @Bind(R.id.iv_return)
    ImageView ivReturn;
    //标题
    @Bind(R.id.tv_title)
    TextView tvTitle;
    //标题总布局
    @Bind(R.id.app_bar_layout)
    AutoRelativeLayout appBarLayout;

    @Override
    protected void initUI() {
        setContentView(R.layout.act_self_query);
    }

    @Override
    protected void initData() {
        //显示返回按钮
        ivReturn.setVisibility(View.VISIBLE);
        //设置状态栏 背景颜色
        appBarLayout.setBackgroundResource(R.color.color_bg_blue);
        //设置标题
        tvTitle.setText("自助查询");
    }


    /**
     * 按钮点击事件
     *
     * @param view
     */
    @OnClick({R.id.iv_return,R.id.tv_query_unicom, R.id.tv_query_telecom,
            R.id.tv_query_mobile, R.id.tv_query_other})
    public void onClick(View view) {

        switch (view.getId()) {

            case R.id.iv_return:            //返回按钮
                finish();
                break;

            case R.id.tv_query_unicom:      //联通自助查询
                setSelfQuery("联通自助查询","http://wap.10010.com/t/siteMap.htm?menuId=query");
                break;

            case R.id.tv_query_telecom:     //电信自助查询
                setSelfQuery("电信自助查询","http://wapjl.189.cn/service/bill/balanceQuery.action?servId=124");
                break;

            case R.id.tv_query_mobile:      //移动自助查询
                setSelfQuery("移动自助查询","https://login.10086.cn/html/login/touch.html?channelID=12014&backUrl=http%3A%2F%2Ftouch.10086.cn%2Fi%2Fmobile%2Fmybalance.html");
                break;

            case R.id.tv_query_other:       //170自助查询
                setSelfQuery("170自助查询",Constant.HTTP_URL+"Content/MobileHtml/170.html");
                break;
        }
    }

    /**
     * 跳转自助查询页面
     */
    private void setSelfQuery(String title,String url) {
        //传递 参数 bundle
        Bundle bundle = new Bundle();
        //标题
        bundle.putString(Constant.WEB_TITLE,title);
        //地址
        bundle.putString(Constant.WEB_URL,url);
        //开始跳转
        JumperUtils.JumpTo(SelfQueryActivity.this, WebDateActivity.class,bundle);
    }
}
